package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.assProductionPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName:basisEditMapp
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/10/16 20:20
 * @Version 1.0
 */
@Mapper
public interface basisEditMapp {
    //插入一条新的装配产量信息
    @DS("baodingRussia")
    @Insert("insert into assProduction (" +
            "dateUse, assEb05, assEb35, " +
            "assEn19, assEn38, assEb75, " +
            "classes, deleteSign, establishTime, " +
            "updateTime, editName) " +
            "VALUES " +
            "(#{dateUse},#{assEb05},#{assEb35}," +
            "#{assEn19},#{assEn38},#{assEb75}," +
            "#{classes},#{deleteSign},#{establishTime}," +
            "#{updateTime},#{editName})")
    void basisEditAssProductionInsertOne(assProductionPojo assProductionPojo);
    //查询有多少条生产数据
    @DS("baodingRussia")
    @Select("SELECT COUNT(*) FROM assProduction  WHERE deleteSign = 1")
    Integer basisQueryAllNumAssProduction();
    @DS("baodingRussia")
    @Select("select * from assProduction WHERE deleteSign = 1 ORDER BY dateUse DESC  LIMIT #{pageStart}, #{pageItems}")
    List<assProductionPojo> paginationQueryAssProduction(Integer pageStart, Integer pageItems);
    //修改一条装配生产信息表
    @DS("baodingRussia")
    @Update("update assProduction set " +
            "dateUse=#{dateUse}, " +
            "assEb05=#{assEb05}, " +
            "assEb35=#{assEb35}, " +
            "assEn19=#{assEn19}, " +
            "assEn38=#{assEn38}, " +
            "assEb75=#{assEb75}," +
            "classes=#{classes}, " +
            "deleteSign=#{deleteSign}, " +
            "updateTime=#{updateTime}, " +
            "editName=#{editName} where id=#{id}" )
    void basisEditEditAssProduction(assProductionPojo assProductionPojo);
    //根据两个字段，查询出数据，就是一行
    @DS("baodingRussia")
    @Select("select * from assProduction where ${oneFieldName}=#{oneFieldVal} and ${towFieldName}=#{towFieldVal} and deleteSign=1")
    assProductionPojo towFieldQueryAssProduction(String oneFieldName, String oneFieldVal, String towFieldName, String towFieldVal);
}
